/**
 * @file   Heap.h
 * @author mikan <mikan@mikan>
 * @date   Sun Sep 27 14:30:07 2020
 * 
 * @brief  
 * 
 * 
 */

#ifndef __CRAZYFISH_HEAP__
#define __CRAZYFIGH_HEAP__
class Heap{
private:
  int *data;
  int length;
public:
#define PARENT(i) ((((i)+1)>>1)-1)
#define LEFTCHILD(i) ((((i)+1)<<1)-1)
#define RIGHTCHILD(i) (((i)+1)<<1)
  int get_length();
  int get_height();
  Heap();
  /** 
   * 
   * 
   * @param datahead Pointer to the elements data.
   * @param l Total number of the elements.
   */
  Heap(int *datahead,int l);
  ~Heap();
  bool is_empty();
  int printout();
  int sort();
  /** 
   * 
   * 
   * @param i 
   * 
   * @return 
   */
  int shiftdown(int i);

};
#else
// Do nothing
#endif
